package core.command
{
	import core.event.SocketEventID;
	import core.event.UnoEvent;
	import core.event.ViewEventID;
	
	public class StandUpUpdateCommand extends SuperCommand
	{
		public function StandUpUpdateCommand()
		{
			socketEvent = SocketEventID.STAND_UP_UPDATE;
			viewEvent = ViewEventID.STAND_UP_UPDATE;
		}
		
		override public function success(e:UnoEvent):void
		{
			delete db.tableList[e.data.tableID].userList[e.data.seatID];
			delete db.tableList[e.data.tableID].config[e.data.seatID];
			var user:Object = db.userList[e.data.userID];
			user.seatID = "";
			user.tableID = "";
			if(e.data.createrID!="")
			{
				db.tableList[e.data.tableID].createrID = e.data.createrID;
				for each(var seat:Object in db.tableList[e.data.tableID].userList)
				{
					if(seat.userID==e.data.createrID)
					{
						seat.ready = "1";
						break;
					}
				}
			}
		}
	}
}